package convert;

import org.apache.poi.ss.util.CellRangeAddress;

public class MergeCell 
{
	private int m_x1;
	private int m_y1;
	private int m_x2;
	private int m_y2;
	private int m_w;
	private int m_h;
	
	public MergeCell(CellRangeAddress cellRange)
	{
		m_x1 = cellRange.getFirstColumn();
		m_y1 = cellRange.getFirstRow();
		m_x2 = cellRange.getLastColumn();
		m_y2 = cellRange.getLastRow();
		m_w = m_x2 - m_x1 + 1;
		m_h = m_y2 - m_y1 + 1;
	}
	
	public MergeCell(int x, int y)
	{
		m_x1 = x;
		m_y1 = y;
		m_x2 = x;
		m_y2 = y;
		m_w = 1;
		m_h = 1;
	}
	
	public int getX1()
	{
		return m_x1;
	}
	
	public int getY1()
	{
		return m_y1;
	}
	
	public int getX2()
	{
		return m_x2;
	}
	
	public int getY2()
	{
		return m_y2;
	}
	
	public int getWidth()
	{
		return m_w;
	}
	
	public int getHeight()
	{
		return m_h;
	}
	
	protected boolean isMergeCell(int row, int column)
	{
		return (column <= m_x2 && column >= m_x1 && row <= m_y2 && row >= m_y1);
	}
}
